<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=US-ASCII">
<title>Specualtive execution</title>
<link rel="stylesheet" href="../../../../../doc/src/boostbook.css" type="text/css">
<meta name="generator" content="DocBook XSL Stylesheets V1.75.2">
<link rel="home" href="../index.html" title="Chapter&#160;1.&#160;Fiber">
<link rel="up" href="../index.html" title="Chapter&#160;1.&#160;Fiber">
<link rel="prev" href="integration/deeper_dive_into___boost_asio__.html" title="Deeper Dive into Boost.Asio">
<link rel="next" href="numa.html" title="NUMA">
</head>
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
<table cellpadding="2" width="100%"><tr>
<td valign="top"><img alt="Boost C++ Libraries" width="277" height="86" src="../../../../../boost.png"></td>
<td align="center"><a href="../../../../../index.html">Home</a></td>
<td align="center"><a href="../../../../../libs/libraries.htm">Libraries</a></td>
<td align="center"><a href="http://www.boost.org/users/people.html">People</a></td>
<td align="center"><a href="http://www.boost.org/users/faq.html">FAQ</a></td>
<td align="center"><a href="../../../../../more/index.htm">More</a></td>
</tr></table>
<hr>
<div class="spirit-nav">
<a accesskey="p" href="integration/deeper_dive_into___boost_asio__.html"><img src="../../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../index.html"><img src="../../../../../doc/src/images/up.png" alt="Up"></a><a accesskey="h" href="../index.html"><img src="../../../../../doc/src/images/home.png" alt="Home"></a><a accesskey="n" href="numa.html"><img src="../../../../../doc/src/images/next.png" alt="Next"></a>
</div>
<div class="section">
<div class="titlepage"><div><div><h2 class="title" style="clear: both">
<a name="fiber.speculation"></a><a name="speculation"></a><a class="link" href="speculation.html" title="Specualtive execution">Specualtive
    execution</a>
</h2></div></div></div>
<h4>
<a name="fiber.speculation.h0"></a>
      <span><a name="fiber.speculation.hardware_transactional_memory"></a></span><a class="link" href="speculation.html#fiber.speculation.hardware_transactional_memory">Hardware
      transactional memory</a>
    </h4>
<p>
      With help of hardware transactional memory multiple logical processors execute
      a critical region speculatively, e.g. without explicit synchronization.<br>
      If the transactional execution completes successfully, then all memory operations
      performed within the transactional region are commited without any inter-thread
      serialization.<br> When the optimistic execution fails, the processor aborts
      the transaction and discards all performed modifications.<br> In non-transactional
      code a single lock serializes the access to a critical region. With a transactional
      memory, multiple logical processor start a transaction and update the memory
      (the data) inside the ciritical region. Unless some logical processors try
      to update the same data, the transactions would always succeed.
    </p>
<h4>
<a name="fiber.speculation.h1"></a>
      <span><a name="fiber.speculation.intel_transactional_synchronisation_extensions__tsx_"></a></span><a class="link" href="speculation.html#fiber.speculation.intel_transactional_synchronisation_extensions__tsx_">Intel
      Transactional Synchronisation Extensions (TSX)</a>
    </h4>
<p>
      TSX is Intel's implementation of hardware transactional memory in modern Intel
      processors<sup>[<a name="fiber.speculation.f0" href="#ftn.fiber.speculation.f0" class="footnote">7</a>]</sup>.<br> In TSX the hardware keeps track of which cachelines have
      been read from and which have been written to in a transaction. The cache-line
      size (64-byte) and the n-way set associative cache determine the maximum size
      of memory in a transaction. For instance if a transaction modifies 9 cache-lines
      at a processor with a 8-way set associative cache, the transaction will always
      be aborted.
    </p>
<div class="note"><table border="0" summary="Note">
<tr>
<td rowspan="2" align="center" valign="top" width="25"><img alt="[Note]" src="../../../../../doc/src/images/note.png"></td>
<th align="left">Note</th>
</tr>
<tr><td align="left" valign="top"><p>
        TXS is enabled if property <code class="computeroutput"><span class="identifier">htm</span><span class="special">=</span><span class="identifier">tsx</span></code> is
        specified at b2 command-line and <code class="computeroutput"><span class="identifier">BOOST_USE_TSX</span></code>
        is applied to the compiler.
      </p></td></tr>
</table></div>
<div class="note"><table border="0" summary="Note">
<tr>
<td rowspan="2" align="center" valign="top" width="25"><img alt="[Note]" src="../../../../../doc/src/images/note.png"></td>
<th align="left">Note</th>
</tr>
<tr><td align="left" valign="top"><p>
        A TSX-transaction will be aborted if the floating point state is modified
        inside a critical region. As a consequence floating point operations, e.g.
        store/load of floating point related registers during a fiber (context) switch
        are disabled.
      </p></td></tr>
</table></div>
<div class="important"><table border="0" summary="Important">
<tr>
<td rowspan="2" align="center" valign="top" width="25"><img alt="[Important]" src="../../../../../doc/src/images/important.png"></td>
<th align="left">Important</th>
</tr>
<tr><td align="left" valign="top"><p>
        TSX can not be used together with MSVC at this time!
      </p></td></tr>
</table></div>
<p>
      Boost.Fiber uses TSX-enabled spinlocks to protect critical regions (see section
      <a class="link" href="tuning.html#tuning">Tuning</a>).
    </p>
<div class="footnotes">
<br><hr width="100" align="left">
<div class="footnote"><p><sup>[<a name="ftn.fiber.speculation.f0" href="#fiber.speculation.f0" class="para">7</a>] </sup>
        intel.com: <a href="https://software.intel.com/en-us/node/695149" target="_top">Intel
        Transactional Synchronization Extensions</a>
      </p></div>
</div>
</div>
<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
<td align="left"></td>
<td align="right"><div class="copyright-footer">Copyright &#169; 2013 Oliver Kowalke<p>
        Distributed under the Boost Software License, Version 1.0. (See accompanying
        file LICENSE_1_0.txt or copy at <a href="http://www.boost.org/LICENSE_1_0.txt" target="_top">http://www.boost.org/LICENSE_1_0.txt</a>)
      </p>
</div></td>
</tr></table>
<hr>
<div class="spirit-nav">
<a accesskey="p" href="integration/deeper_dive_into___boost_asio__.html"><img src="../../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../index.html"><img src="../../../../../doc/src/images/up.png" alt="Up"></a><a accesskey="h" href="../index.html"><img src="../../../../../doc/src/images/home.png" alt="Home"></a><a accesskey="n" href="numa.html"><img src="../../../../../doc/src/images/next.png" alt="Next"></a>
</div>
</body>
</html>
